<?php
// .-----------------------------------------------------------------------------------
// | WE TRY THE BEST WAY
// |-----------------------------------------------------------------------------------
// | Author: 贝贝 <hebiduhebi@163.com>
// | Copyright (c) 2013-2015, http://www.gooraye.net. All Rights Reserved.
// |-----------------------------------------------------------------------------------


namespace Shop\Widget;
use Admin\Api\DatatreeApi;
use Shop\Api\ProductApi;
use Shop\Controller\ShopController;

class PartialsWidget extends ShopController{

	
	/**
	 * 数据字典
	 */
	public function nav_group(){
        $result = apiCall(ProductApi::QUERY_ALL_COUNTRY);
        if($result['status'] && is_array($result['info'])){
            $dt_country = getDatatree("COUNTRY");
            $map = array(
                'parentid'=>$dt_country,
            );
            $code_arr = array();
            foreach($result['info'] as $vo){
                array_push($code_arr,$vo['dt_origin_country']);
            }

            $map['code'] = array('in',$code_arr);
            $result = apiCall(DatatreeApi::QUERY_NO_PAGING,array($map));
            if($result['status']){
                $this->assign('nav_group',$result['info']);
                echo $this->theme($this->themeType)->fetch("Widget/nav_group");
            }else{
                LogRecord($result['info'], "[INFO]:".__FILE__." [LINE]".__LINE__);
                echo L('ERR_SYSTEM_BUSY');
            }
        }


		
	}
	
}
